<template>
	<view class="myOrderBox">
            <view class="artItem bgWhite   mlr15 mb15 justify-between align-center" v-for="(i,n) in orderList" :key="n">
                <view class="flex-col   left  justify-center mr20 ">
                    <view class="name clamp2">{{i.title}}</view>
                    <text class="time">{{i.create_time}}</text>
					<view class="collect align-center justify-center" @click="collect(i)">
							<uv-icon name="star" color="#000" ></uv-icon>
							收藏

					</view>
                </view>
				<image :src="$domain.api+i.img_url" mode=""></image>
				
            </view>
        <view class="" v-if="orderList.length==0">
            <uv-empty ></uv-empty>
        </view>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleFlag: 0,
                orderList:[],
                allCarData:[],
                orderItem:{},
                imgList:[],
                user_id:uni.getStorageSync('userId')

			};
		},
		onLoad() {
            this.getList()
		},
		onShow() {
			// if (!uni.getStorageSync('logintoken')) {
			// 	uni.reLaunch({
			// 		url: '/pages/login/login'
			// 	})
			// 	return
			// }
			// this.getOrder()
		},
		methods: {
			collect(item) {
				this.$api.savecollect({
					categoryId: 3,
					userId: uni.getStorageSync('userId'),
					itemId: item.id
				}).then(res => {
					console.log(res)
					uni.showToast({
						title: '收藏成功'
					})
				})
			},
            formateTime(data){
              return this.$utils.formatDateTime(data)  
            },
			
			async getList() {
				let data = await this.$api.myreport({userId:this.user_id})
				console.log(data)
                this.orderList = data.data
			},

		}
	}
</script>

<style lang="scss" scoped>
	.myOrderBox {
		min-height: 100vh;
		position: relative;
		
        padding: 20rpx 0;
		

	}	
    .submitPz{
        width: 165rpx;
        height: 54rpx;
        background: #434343;
        border-radius: 6rpx;
        font-size: 24rpx;
        color: #FFFFFF;
        text-align: center;
        line-height: 54rpx;
    }
    .artItem {
        
        
        
        margin-bottom: 36rpx;
            font-size: 24rpx;
            color: #666666;
        .left{
            
         padding-top: 8rpx;
        }
        .time{
           font-weight: 400;
           font-size: 20rpx;
           color: #666666;
		   margin: 12rpx 0 16rpx;
           
        }
        .name{
		width: 414rpx;
		font-size: 30rpx;
		color: #3D3D3D;
		
        }
		image{
			width: 232rpx;
			height: 162rpx;
		}
    }
	.collect{
		border-radius: 60rpx;
		border: 2rpx solid rgba(0,0,0,0.1);
		width: 122rpx;
		height: 52rpx;
		
		box-sizing: content-box;
	}
    .service{
        width: 140rpx;
        height: 66rpx;
        background: #E6220A;
        color: #fff;
        text-align: center;
        font-size: 32rpx;
        line-height: 66rpx;
        border-radius: 60rpx 60rpx 60rpx 60rpx;
        margin-right: 20rpx;
    }
</style>